package com.wc.alorithm_luogu.P2392;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/28 21:44
 * @description https://www.luogu.com.cn/problem/P2392
 */
public class Main2 {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 25;
    static int[] n = new int[5];
    static int[] a = new int[N];
    static int tmpN;
    static int tmpAns;

    public static void main(String[] args) {
        int res = 0;
        for (int i = 1; i <= 4; i++) {
            n[i] = sc.nextInt();
        }

        for (int i = 1; i <= 4; i++) {
            for (int j = 1; j <= n[i]; j++) {
                a[j] = sc.nextInt();
            }
            tmpAns = 1200;
            tmpN = n[i];
            dfs(1, 0, 0);
            res += tmpAns;
        }
        out.println(res);
        out.flush();
    }

    static void dfs(int floor, int l, int r) {
        if (floor == tmpN + 1) {
            tmpAns = Math.min(tmpAns, Math.max(l, r));
            return;
        }
        dfs(floor + 1, l + a[floor], r);
        dfs(floor + 1, l, r + a[floor]);
    }

}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}